﻿using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.Text;
using System.Globalization;


namespace GoogleMapWebAPI
{
    public class GoogleMapWebAPI
    {
        public enum MapStyle
        {
            G_NORMAL_MAP,
            G_SATELLITE_MAP,
            G_HYBRID_MAP,
            G_PHYSICAL_MAP
        };
        private int pzoom;
        private string pmapContainer;
        private MapStyle pmapStyle;
        private decimal platitude;
        private decimal plongitude;
        private bool ppushPin;
        private string ppushPinTitle;
        private String ppushPinDescription;
        private String pMapWidth;
        private String pMapHeight;
        public int zoom { get; set; }
        public string mapContainer { get; set; }
        public MapStyle mapStyle { get; set; }
        public decimal latitude { get; set; }
        public decimal longitude { get; set; }
        public bool pushPin { get; set; }
        public string pushPinTitle { get; set; }
        public string pushPinDescription { get; set; }
        public string MapWidth { get; set; }
        public string MapHeight { get; set; }
        public  String InjectJavaScriptBingMaps()
        {
            StringBuilder javascriptFunction = new StringBuilder();
            javascriptFunction.Append("getGoogleMaps(");
            javascriptFunction.Append("'myMap',");
            javascriptFunction.Append("" + latitude.ToString(CultureInfo.InvariantCulture.NumberFormat) + ",");
            javascriptFunction.Append("" + longitude.ToString(CultureInfo.InvariantCulture.NumberFormat) + ",");
            javascriptFunction.Append("" + zoom + ",");
            javascriptFunction.Append("" + pushPin.ToString().ToLower() + ",");
            javascriptFunction.Append("'" + pushPinTitle + "',");
            javascriptFunction.Append("'" + pushPinDescription + "',");
            javascriptFunction.Append("" + mapStyle + ",");
            javascriptFunction.Append("'" + MapWidth + "',");
            javascriptFunction.Append("'" + MapHeight + "'");
            javascriptFunction.Append(");");
            return javascriptFunction.ToString();
        }
    }
}
